package de.jamm.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class LogginContent extends JammContent {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static JTextArea logTextArea = new JTextArea();
	private static JScrollPane scrollPane = new JScrollPane();
	public LogginContent(Dimension d, String title, String iconPath) {
		super(d, title, iconPath);
		
		JPanel content = super.getContentPane();
		content.setOpaque(false);
		content.setLayout(new BorderLayout());
		scrollPane.setViewportView(logTextArea);

		logTextArea.setBorder(null);
		logTextArea.setForeground(Color.WHITE);
		logTextArea.setEditable(false);
		logTextArea.setEnabled(false);
		logTextArea.setFocusable(false);
		logTextArea.setAutoscrolls(true);
		scrollPane.setBorder(null);
		logTextArea.setOpaque(false);
		scrollPane.getViewport().add(logTextArea);
		scrollPane.getViewport().setOpaque(false);
		scrollPane.setOpaque(false);
		scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		content.add(scrollPane);
	}
	public static JTextArea getTextPane() {
		return logTextArea;
	}
	public static void repaintAll() {
		// TODO Auto-generated method stub
		scrollPane.setViewportView(logTextArea);
		scrollPane.getVerticalScrollBar().setValue(scrollPane.getVerticalScrollBar().getMaximum());
		
		if(GuiController.getInstance() != null)
		GuiController.getInstance().repaintGui();
	}
}
